package models

// Data is the request body for the txt2img request
type Data struct {
	Prompt         string `json:"prompt"`
	NegativePrompt string `json:"negative_prompt"`
	Seed           int    `json:"seed"`
	//SamplerName      string  `json:"sampler_name"`
	SamplerIndex     string  `json:"sampler_index"`
	CfgScale         float64 `json:"cfg_scale"`
	Width            int     `json:"width"`
	Height           int     `json:"height"`
	BatchSize        int     `json:"batch_size"`
	NIter            int     `json:"n_iter"`
	Steps            int     `json:"steps"`
	ReturnGrid       bool    `json:"return_grid"`
	RestoreFaces     bool    `json:"restore_faces"`
	SendImages       bool    `json:"send_images"`
	SaveImages       bool    `json:"save_images"`
	DoNotSaveSamples bool    `json:"do_not_save_samples"`
	DoNotSaveGrid    bool    `json:"do_not_save_grid"`
	TaskId           string  `json:"txt2img_task_id"`
}

func NewData() *Data {
	return &Data{
		Prompt:         "textures",
		NegativePrompt: "",
		Seed:           -1,
		SamplerIndex:   "DPM++ 2M Karras",
		//SamplerIndex:     "Euler",
		CfgScale:         7,
		Width:            512,
		Height:           512,
		BatchSize:        2,
		NIter:            2,
		Steps:            100,
		ReturnGrid:       false,
		RestoreFaces:     false,
		SendImages:       true,
		SaveImages:       false,
		DoNotSaveSamples: false,
		DoNotSaveGrid:    false,
		TaskId:           "default task id",
	}
}

//
//{
//"images": [
//"string"
//],
//"parameters": {},
//"info": "string"
//}

type SuccessResponse struct {
	Images     []string `json:"images"`
	Parameters Data     `json:"parameters"`
	Info       string   `json:"info"`
}

// {
// "detail": [
// {
// "loc": [
// "string",
// 0
// ],
// "msg": "string",
// "type": "string"
// }
// ]
// }
type FailureResponse struct {
	Detail []struct {
		Loc  []string `json:"loc"`
		Msg  string   `json:"msg"`
		Type string   `json:"type"`
	} `json:"detail"`
}

type Response struct {
	Images []string `json:"images"`
}

//
//{
//"progress": 0,
//"eta_relative": 0,
//"state": {
//"skipped": false,
//"interrupted": false,
//"job": "",
//"job_count": 0,
//"job_timestamp": "20240311101345",
//"job_no": 1,
//"sampling_step": 0,
//"sampling_steps": 5
//},
//"current_image": null,
//"textinfo": null
//}

type ProcessResponse struct {
	Progress     float64      `json:"progress"`
	EtaRelative  float64      `json:"eta_relative"`
	State        ProcessState `json:"state"`
	CurrentImage string       `json:"current_image"`
	TextInfo     string       `json:"textinfo"`
}
type ProcessState struct {
	Skipped        bool   `json:"skipped"`
	Interrupted    bool   `json:"interrupted"`
	Job            string `json:"job"`
	JobCount       int    `json:"job_count"`
	JobTimestamp   string `json:"job_timestamp"`
	JobNo          int    `json:"job_no"`
	SamplingStep   int    `json:"sampling_step"`
	SamplingSteps  int    `json:"sampling_steps"`
	JobTimestampMs int    `json:"job_timestamp_ms"`
}
